package com.example.administrator.nurse.present;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;

import com.example.administrator.nurse.R;
import com.example.administrator.nurse.base.BaseActivity;
import com.example.administrator.nurse.base.BaseWebview;


/**
 * Created by Administrator on 2016/2/3.
 *
 */

public class webViewActivity extends BaseActivity {

    BaseWebview thisWebView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        thisWebView = (BaseWebview) f(R.id.scan_web);
        f(R.id.scan).setVisibility(View.GONE);
        ImageView imageView = (ImageView) f(R.id.config);
        imageView.setImageResource(R.mipmap.back);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                System.gc();
            }
        });
        thisWebView.loadUrl(getIntent().getStringExtra("content"));
        /*thisWebView.defaultLoadDataWithBaseURL(
                getIntent().getStringExtra("content")
        );*/
    }

    @Override
    protected int setLayotId() {
        return R.layout.scan_ac;
    }

    @Override
    protected void onFailure(int requestCode, Object object, String errorMsg) {

    }

    @Override
    protected void onSuccess(int requestCode, Object object, String response) {

    }



    @Override
    // 设置回退
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && thisWebView.canGoBack()) {
            thisWebView.goBack(); // goBack()表示返回WebView的上一页面
            return true;
        }
        return super.onKeyDown(keyCode,event);
    }
}
